FROM alpine

RUN apk --update --no-cache add openssh-server
ADD ssh/id_rsa.pub /root/.ssh/authorized_keys
RUN mkdir /ssh \
    && ssh-keygen -N '' -q -t rsa -f /ssh/ssh_host_rsa_key \
	&& ssh-keygen -N '' -q -t dsa -f /ssh/ssh_host_dsa_key \
	&& ssh-keygen -N '' -q -t ecdsa -f /ssh/ssh_host_ecdsa_key \
	&& chmod 600 -R /ssh/ \
	&& chmod 600 -R /root/.ssh \
	&& echo root:root | chpasswd

RUN sed -i '20a\HostKey /ssh/ssh_host_rsa_key' /etc/ssh/sshd_config \
	&& sed -i '20a\HostKey /ssh/ssh_host_dsa_key' /etc/ssh/sshd_config \
	&& sed -i '20a\HostKey /ssh/ssh_host_ecdsa_key' /etc/ssh/sshd_config \
	&& sed -i '20a\PermitRootLogin yes' /etc/ssh/sshd_config



EXPOSE 22

CMD /usr/sbin/sshd -D